<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>InputStreamReader</title>

    <link type="text/css" rel="stylesheet" href="style.css"/>
</head>
<body>

<div class="topicContainer">

<div>

<div class="topic">
    <h1 class="title">InputStreamReader Class</h1>

    <div class="lw_vs">
        <div id="curversion">
            <strong>Java 1.6</strong>
        </div>
    </div>
</div>
<div style="clear:both;"></div>

<div id="mainSection">
<div id="mainBody">

<div>
    <div class="summary">
        <p>An InputStreamReader is a bridge from byte streams to character streams: It
            reads bytes and decodes them into characters using a specified {@link
            java.nio.charset.Charset <code>charset</code>}.</p>
        <p>The charset that it uses may be specified by name or may be given explicitly, or the platform's
            default charset may be accepted.</p>

        <p>Each invocation of one of an InputStreamReader's read() methods may
            cause one or more bytes to be read from the underlying byte-input stream.</p>
        <p>To enable the efficient conversion of bytes to characters, more bytes may
            be read ahead from the underlying stream than are necessary to satisfy the
            current read operation.</p>

        <p> For top efficiency, consider wrapping an InputStreamReader within a
            BufferedReader. For example:
                <pre>
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));</pre>
    </div>


</div>

<div>
    <div class="LW_CollapsibleArea_TitleDiv">
        <div>
            <a href="javascript:void(0)" class="LW_CollapsibleArea_TitleAhref" title="Collapse">
                <span class="cl_CollapsibleArea_expanding LW_CollapsibleArea_Img"></span>
                <span class="LW_CollapsibleArea_Title">Inheritance Hierarchy</span>
            </a>

            <div class="LW_CollapsibleArea_HrDiv">
                <hr class="LW_CollapsibleArea_Hr">
            </div>
        </div>
    </div>

    <div class="sectionblock">
        <!--<a id="familyToggle" xmlns="http://www.w3.org/1999/xhtml"></a>-->
        <a href="http://msdn.microsoft.com/en-us/library/system.object">java.lang.Object</a><br>
        &nbsp;&nbsp;<a href="http://msdn.microsoft.com/en-us/library/system.exception">java.io.Reader</a><br>
        &nbsp;&nbsp;&nbsp;&nbsp;<span class="selflink">java.io.InputStreamReader</span><br>
        <!--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="selflink">java.io.FileReader</span><br>-->
    </div>
</div>
<br>

<strong>Package:</strong>&nbsp;<a href="#">java.io</a><br>
<strong>Since:</strong>&nbsp;1.1

<div>
    <div class="LW_CollapsibleArea_TitleDiv">
        <div><a href="javascript:void(0)" class="LW_CollapsibleArea_TitleAhref" title="Collapse"><span
                class="cl_CollapsibleArea_expanding LW_CollapsibleArea_Img"></span><span
                class="LW_CollapsibleArea_Title">Syntax</span></a>

            <div class="LW_CollapsibleArea_HrDiv">
                <hr class="LW_CollapsibleArea_Hr">
            </div>
        </div>
    </div>
    <div class="sectionblock"><a id="syntaxToggle">

    </a>
        <div class="codeSnippetContainer">
            <div class="codeSnippetContainerCodeContainer">
                <!--<div class="codeSnippetToolBar"></div>-->
                <div id="CodeSnippetContainerCode_111" class="codeSnippetContainerCode" dir="ltr">
                    <div style="color:Black;">
                        <pre><span style="color:Blue;">public class</span> InputStreamReader <span style="color:Blue;">extends</span> Reader</pre>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<p>The <span class="selflink">InputStreamReader</span> type exposes the following members.</p>

<div>
    <div class="LW_CollapsibleArea_TitleDiv">
        <div><a href="javascript:void(0)" class="LW_CollapsibleArea_TitleAhref" title="Collapse"><span
                class="cl_CollapsibleArea_expanding LW_CollapsibleArea_Img"></span>
            <span class="LW_CollapsibleArea_Title">Constructors</span></a>

            <div class="LW_CollapsibleArea_HrDiv">
                <hr class="LW_CollapsibleArea_Hr">
            </div>
        </div>
    </div>
    <div class="sectionblock">
        <a id="constructorTableToggle"></a>
        <table id="memberList" class="members">
            <tbody>

            <tr>
                <th class="iconColumn">&nbsp;</th>
                <th class="nameColumn">Name</th>
                <th class="descriptionColumn">Description</th>
            </tr>

            <tr data="public;declared;portable_library;">
                <td>
                    <img id="pubmethod" alt="Public method" src="clear.gif" title="Public method" class="cl_IC91302">
                </td>
                <td>
                    <a href="#">InputStreamReader(InputStream in)</a>
                </td>
                <td>
                    <span>Creates an <span class="selflink">InputStreamReader</span> that uses the default charset.</span>
                </td>
            </tr>

            <tr data="public;declared;portable_library;">
                <td>
                    <img id="pubmethod" alt="Public method" src="clear.gif" title="Public method" class="cl_IC91302">
                </td>
                <td>
                    <a href="#">InputStreamReader(InputStream in, String charsetName)</a>
                </td>
                <td>
                    <span>Creates an <span class="selflink">InputStreamReader</span> that uses the named charset.</span>
                </td>
            </tr>

            <tr data="public;declared;portable_library;">
                <td>
                    <img id="pubmethod" alt="Public method" src="clear.gif" title="Public method" class="cl_IC91302">
                </td>
                <td>
                    <a href="#">InputStreamReader(InputStream in, Charset cs)</a>
                </td>
                <td>
                    <span>Creates an <span class="selflink">InputStreamReader</span> that uses the given charset.</span>
                </td>
            </tr>

            <tr data="public;declared;portable_library;">
                <td>
                    <img id="pubmethod" alt="Public method" src="clear.gif" title="Public method" class="cl_IC91302">
                </td>
                <td>
                    <a href="#">InputStreamReader(InputStream in, CharsetDecoder dec)</a>
                </td>
                <td>
                    <span>Creates an <span class="selflink">InputStreamReader</span> that uses the given charset decoder.</span>
                </td>
            </tr>

            </tbody>
        </table>
        <a href="#mainBody">Top</a></div>
</div>

<div>
    <div class="LW_CollapsibleArea_TitleDiv">
        <div><a href="javascript:void(0)" class="LW_CollapsibleArea_TitleAhref" title="Collapse"><span
                class="cl_CollapsibleArea_expanding LW_CollapsibleArea_Img"></span><span
                class="LW_CollapsibleArea_Title">Methods</span></a>

            <div class="LW_CollapsibleArea_HrDiv">
                <hr class="LW_CollapsibleArea_Hr">
            </div>
        </div>
    </div>
    <div class="sectionblock"><a id="methodTableToggle">

    </a>
        <table id="memberList" class="members">
            <tbody>

            <tr>
                <th class="iconColumn">&nbsp;</th>
                <th class="nameColumn">Name</th>
                <th class="descriptionColumn">Description</th>
            </tr>

            <tr data="public;">
                <td>
                    <img id="pubmethod" alt="Public method" src="clear.gif" title="Public method" class="cl_IC91302">
                </td>
                <td>
                    <a href="#">getEncoding()</a>
                </td>
                <td>
                    Returns the name of the character encoding being used by this stream.

                    <p>If the encoding has an historical name then that name is returned;
                    otherwise the encoding's canonical name is returned.

                    <p>If this instance was created with the {@link
                    #InputStreamReader(InputStream, String)} constructor then the returned
                    name, being unique for the encoding, may differ from the name passed to
                    the constructor. This method will return <code>null</code> if the
                    stream has been closed.
                    </p>
                </td>
            </tr>

            <tr data="public;">
                <td>
                    <img id="pubmethod" alt="Public method" src="clear.gif" title="Public method" class="cl_IC91302">
                </td>
                <td>
                    <a href="#">read()</a>
                </td>
                <td>Reads a single character.</td>
            </tr>

            <tr data="public;">
                <td>
                    <img id="pubmethod" alt="Public method" src="clear.gif" title="Public method" class="cl_IC91302">
                </td>
                <td>
                    <a href="#">read(char cbuf[], int offset, int length)</a>
                </td>
                <td>Reads characters into a portion of an array.</td>
            </tr>

            <tr data="public;">
                <td>
                    <img id="pubmethod" alt="Public method" src="clear.gif" title="Public method" class="cl_IC91302">
                </td>
                <td>
                    <a href="#">ready()</a>
                </td>
                <td>Tells whether this stream is ready to be read.  An <span class="selflink">InputStreamReader</span> is
                    ready if its input buffer is not empty, or if bytes are available to be
                    read from the underlying byte stream.</td>
            </tr>

            <tr data="public;">
                <td>
                    <img id="pubmethod" alt="Public method" src="clear.gif" title="Public method" class="cl_IC91302">
                </td>
                <td>
                    <a href="#">close()</a>
                </td>
                <td>&nbsp;</td>
            </tr>

            </tbody>
        </table>
        <a href="#mainBody">Top</a></div>
</div>
<div>
    <div class="LW_CollapsibleArea_TitleDiv">
        <div><a href="javascript:void(0)" class="LW_CollapsibleArea_TitleAhref" title="Collapse">
            <span class="cl_CollapsibleArea_expanding LW_CollapsibleArea_Img"></span>
            <span class="LW_CollapsibleArea_Title">Fields</span></a>

            <div class="LW_CollapsibleArea_HrDiv">
                <hr class="LW_CollapsibleArea_Hr">
            </div>
        </div>
    </div>
    <div class="sectionblock"><a id="fieldTableToggle">

    </a>
        <table id="memberList1" class="members">
            <tbody>
            <tr>
                <th class="iconColumn">&nbsp;</th>
                <th class="typeColumn">Type</th>
                <th class="nameColumn">Name</th>
                <th class="descriptionColumn">Description</th>
            </tr>

            <tr data="private;">
                <td>
                    <img id="privfield" alt="Private field" src="clear.gif" title="Private field" class="cl_IC157541">
                </td>
                <td>
                    <a href="#">StreamDecoder</a>
                </td>
                <td>sd</td>
                <td>&nbsp;</td>
            </tr>
            </tbody>
        </table>
        <a href="#mainBody">Top</a></div>
</div>
<!--<div>-->
<!--<div class="LW_CollapsibleArea_TitleDiv">-->
    <!--<div><a href="javascript:void(0)" class="LW_CollapsibleArea_TitleAhref" title="Collapse"><span-->
            <!--class="cl_CollapsibleArea_expanding LW_CollapsibleArea_Img"></span><span-->
            <!--class="LW_CollapsibleArea_Title">Explicit&nbsp;Interface&nbsp;Implementations</span></a>-->

        <!--<div class="LW_CollapsibleArea_HrDiv">-->
            <!--<hr class="LW_CollapsibleArea_Hr">-->
        <!--</div>-->
    <!--</div>-->
<!--</div>-->
<!--<div class="sectionblock"><a id="ExplicitInterfaceImplementationTableToggle">-->

<!--</a>-->
<!--<table id="memberList2" class="members">-->
<!--<tbody>-->
<!--<tr>-->
    <!--<th class="iconColumn">-->
        <!--&nbsp;-->
    <!--</th>-->
    <!--<th class="nameColumn">Name</th>-->
    <!--<th class="descriptionColumn">Description</th>-->
<!--</tr>-->
<!--<tr data="explicit;declared;xnafw;">-->

    <!--<td>-->
        <!--<img id="pubinterface" alt="Explicit interface implemetation"-->
             <!--src="http://i.msdn.microsoft.com/areas/global/content/clear.gif"-->
             <!--title="Explicit interface implemetation" class="cl_IC141795">-->
        <!--<img id="privmethod" alt="Private method"-->
             <!--src="http://i.msdn.microsoft.com/areas/global/content/clear.gif" title="Private method"-->
             <!--class="cl_IC6709">-->
        <!--<img id="xna" alt="Supported by the XNA Framework"-->
             <!--src="http://i.msdn.microsoft.com/areas/global/content/clear.gif"-->
             <!--title="Supported by the XNA Framework" class="cl_IC37116">-->
    <!--</td>-->
    <!--<td>-->
        <!--<a href="http://msdn.microsoft.com/en-us/library/bb356975">IConvertible<span>.</span>ToBoolean</a>-->
    <!--</td>-->
    <!--<td>Infrastructure. <span>This conversion is not supported. Attempting to make this conversion throws an <span><a-->
            <!--href="http://msdn.microsoft.com/en-us/library/system.invalidcastexception">InvalidCastException</a></span>.</span>-->
    <!--</td>-->
<!--</tr>-->
<!--<tr data="explicit;declared;xnafw;">-->

    <!--<td>-->
        <!--<img id="pubinterface" alt="Explicit interface implemetation"-->
             <!--src="http://i.msdn.microsoft.com/areas/global/content/clear.gif"-->
             <!--title="Explicit interface implemetation" class="cl_IC141795">-->
        <!--<img id="privmethod" alt="Private method"-->
             <!--src="http://i.msdn.microsoft.com/areas/global/content/clear.gif" title="Private method"-->
             <!--class="cl_IC6709">-->
        <!--<img id="xna" alt="Supported by the XNA Framework"-->
             <!--src="http://i.msdn.microsoft.com/areas/global/content/clear.gif"-->
             <!--title="Supported by the XNA Framework" class="cl_IC37116">-->
    <!--</td>-->
    <!--<td>-->
        <!--<a href="http://msdn.microsoft.com/en-us/library/bb342489">IConvertible<span>.</span>ToByte</a>-->
    <!--</td>-->
    <!--<td>Infrastructure. <span>This conversion is not supported. Attempting to make this conversion throws an <span><a-->
            <!--href="http://msdn.microsoft.com/en-us/library/system.invalidcastexception">InvalidCastException</a></span>.</span>-->
    <!--</td>-->
<!--</tr>-->
<!--<tr data="explicit;declared;xnafw;">-->

    <!--<td>-->
        <!--<img id="pubinterface" alt="Explicit interface implemetation"-->
             <!--src="http://i.msdn.microsoft.com/areas/global/content/clear.gif"-->
             <!--title="Explicit interface implemetation" class="cl_IC141795">-->
        <!--<img id="privmethod" alt="Private method"-->
             <!--src="http://i.msdn.microsoft.com/areas/global/content/clear.gif" title="Private method"-->
             <!--class="cl_IC6709">-->
        <!--<img id="xna" alt="Supported by the XNA Framework"-->
             <!--src="http://i.msdn.microsoft.com/areas/global/content/clear.gif"-->
             <!--title="Supported by the XNA Framework" class="cl_IC37116">-->
    <!--</td>-->
    <!--<td>-->
        <!--<a href="http://msdn.microsoft.com/en-us/library/bb298422">IConvertible<span>.</span>ToChar</a>-->
    <!--</td>-->
    <!--<td>Infrastructure. <span>This conversion is not supported. Attempting to make this conversion throws an <span><a-->
            <!--href="http://msdn.microsoft.com/en-us/library/system.invalidcastexception">InvalidCastException</a></span>.</span>-->
    <!--</td>-->
<!--</tr>-->
<!--<tr data="explicit;declared;xnafw;">-->

    <!--<td>-->
        <!--<img id="pubinterface" alt="Explicit interface implemetation"-->
             <!--src="http://i.msdn.microsoft.com/areas/global/content/clear.gif"-->
             <!--title="Explicit interface implemetation" class="cl_IC141795">-->
        <!--<img id="privmethod" alt="Private method"-->
             <!--src="http://i.msdn.microsoft.com/areas/global/content/clear.gif" title="Private method"-->
             <!--class="cl_IC6709">-->
        <!--<img id="xna" alt="Supported by the XNA Framework"-->
             <!--src="http://i.msdn.microsoft.com/areas/global/content/clear.gif"-->
             <!--title="Supported by the XNA Framework" class="cl_IC37116">-->
    <!--</td>-->
    <!--<td>-->
        <!--<a href="http://msdn.microsoft.com/en-us/library/bb292317">IConvertible<span>.</span>ToDateTime</a>-->
    <!--</td>-->
    <!--<td>Infrastructure. <span>This conversion is not supported. Attempting to make this conversion throws an <span><a-->
            <!--href="http://msdn.microsoft.com/en-us/library/system.invalidcastexception">InvalidCastException</a></span>.</span>-->
    <!--</td>-->
<!--</tr>-->
<!--<tr data="explicit;declared;xnafw;">-->

    <!--<td>-->
        <!--<img id="pubinterface" alt="Explicit interface implemetation"-->
             <!--src="http://i.msdn.microsoft.com/areas/global/content/clear.gif"-->
             <!--title="Explicit interface implemetation" class="cl_IC141795">-->
        <!--<img id="privmethod" alt="Private method"-->
             <!--src="http://i.msdn.microsoft.com/areas/global/content/clear.gif" title="Private method"-->
             <!--class="cl_IC6709">-->
        <!--<img id="xna" alt="Supported by the XNA Framework"-->
             <!--src="http://i.msdn.microsoft.com/areas/global/content/clear.gif"-->
             <!--title="Supported by the XNA Framework" class="cl_IC37116">-->
    <!--</td>-->
    <!--<td>-->
        <!--<a href="http://msdn.microsoft.com/en-us/library/bb361170">IConvertible<span>.</span>ToDecimal</a>-->
    <!--</td>-->
    <!--<td>Infrastructure. <span>This conversion is not supported. Attempting to make this conversion throws an <span><a-->
            <!--href="http://msdn.microsoft.com/en-us/library/system.invalidcastexception">InvalidCastException</a></span>.</span>-->
    <!--</td>-->
<!--</tr>-->
<!--<tr data="explicit;declared;xnafw;">-->

    <!--<td>-->
        <!--<img id="pubinterface" alt="Explicit interface implemetation"-->
             <!--src="http://i.msdn.microsoft.com/areas/global/content/clear.gif"-->
             <!--title="Explicit interface implemetation" class="cl_IC141795">-->
        <!--<img id="privmethod" alt="Private method"-->
             <!--src="http://i.msdn.microsoft.com/areas/global/content/clear.gif" title="Private method"-->
             <!--class="cl_IC6709">-->
        <!--<img id="xna" alt="Supported by the XNA Framework"-->
             <!--src="http://i.msdn.microsoft.com/areas/global/content/clear.gif"-->
             <!--title="Supported by the XNA Framework" class="cl_IC37116">-->
    <!--</td>-->
    <!--<td>-->
        <!--<a href="http://msdn.microsoft.com/en-us/library/bb357599">IConvertible<span>.</span>ToDouble</a>-->
    <!--</td>-->
    <!--<td>Infrastructure. <span>This conversion is not supported. Attempting to make this conversion throws an <span><a-->
            <!--href="http://msdn.microsoft.com/en-us/library/system.invalidcastexception">InvalidCastException</a></span>.</span>-->
    <!--</td>-->
<!--</tr>-->
<!--<tr data="explicit;declared;xnafw;">-->

    <!--<td>-->
        <!--<img id="pubinterface" alt="Explicit interface implemetation"-->
             <!--src="http://i.msdn.microsoft.com/areas/global/content/clear.gif"-->
             <!--title="Explicit interface implemetation" class="cl_IC141795">-->
        <!--<img id="privmethod" alt="Private method"-->
             <!--src="http://i.msdn.microsoft.com/areas/global/content/clear.gif" title="Private method"-->
             <!--class="cl_IC6709">-->
        <!--<img id="xna" alt="Supported by the XNA Framework"-->
             <!--src="http://i.msdn.microsoft.com/areas/global/content/clear.gif"-->
             <!--title="Supported by the XNA Framework" class="cl_IC37116">-->
    <!--</td>-->
    <!--<td>-->
        <!--<a href="http://msdn.microsoft.com/en-us/library/bb301549">IConvertible<span>.</span>ToInt16</a>-->
    <!--</td>-->
    <!--<td>Infrastructure. <span>This conversion is not supported. Attempting to make this conversion throws an <span><a-->
            <!--href="http://msdn.microsoft.com/en-us/library/system.invalidcastexception">InvalidCastException</a></span>.</span>-->
    <!--</td>-->
<!--</tr>-->
<!--<tr data="explicit;declared;xnafw;">-->

    <!--<td>-->
        <!--<img id="pubinterface" alt="Explicit interface implemetation"-->
             <!--src="http://i.msdn.microsoft.com/areas/global/content/clear.gif"-->
             <!--title="Explicit interface implemetation" class="cl_IC141795">-->
        <!--<img id="privmethod" alt="Private method"-->
             <!--src="http://i.msdn.microsoft.com/areas/global/content/clear.gif" title="Private method"-->
             <!--class="cl_IC6709">-->
        <!--<img id="xna" alt="Supported by the XNA Framework"-->
             <!--src="http://i.msdn.microsoft.com/areas/global/content/clear.gif"-->
             <!--title="Supported by the XNA Framework" class="cl_IC37116">-->
    <!--</td>-->
    <!--<td>-->
        <!--<a href="http://msdn.microsoft.com/en-us/library/bb343198">IConvertible<span>.</span>ToInt32</a>-->
    <!--</td>-->
    <!--<td>Infrastructure. <span>This conversion is not supported. Attempting to make this conversion throws an <span><a-->
            <!--href="http://msdn.microsoft.com/en-us/library/system.invalidcastexception">InvalidCastException</a></span>.</span>-->
    <!--</td>-->
<!--</tr>-->
<!--<tr data="explicit;declared;xnafw;">-->

    <!--<td>-->
        <!--<img id="pubinterface" alt="Explicit interface implemetation"-->
             <!--src="http://i.msdn.microsoft.com/areas/global/content/clear.gif"-->
             <!--title="Explicit interface implemetation" class="cl_IC141795">-->
        <!--<img id="privmethod" alt="Private method"-->
             <!--src="http://i.msdn.microsoft.com/areas/global/content/clear.gif" title="Private method"-->
             <!--class="cl_IC6709">-->
        <!--<img id="xna" alt="Supported by the XNA Framework"-->
             <!--src="http://i.msdn.microsoft.com/areas/global/content/clear.gif"-->
             <!--title="Supported by the XNA Framework" class="cl_IC37116">-->
    <!--</td>-->
    <!--<td>-->
        <!--<a href="http://msdn.microsoft.com/en-us/library/bb347253">IConvertible<span>.</span>ToInt64</a>-->
    <!--</td>-->
    <!--<td>Infrastructure. <span>This conversion is not supported. Attempting to make this conversion throws an <span><a-->
            <!--href="http://msdn.microsoft.com/en-us/library/system.invalidcastexception">InvalidCastException</a></span>.</span>-->
    <!--</td>-->
<!--</tr>-->
<!--<tr data="explicit;declared;xnafw;">-->

    <!--<td>-->
        <!--<img id="pubinterface" alt="Explicit interface implemetation"-->
             <!--src="http://i.msdn.microsoft.com/areas/global/content/clear.gif"-->
             <!--title="Explicit interface implemetation" class="cl_IC141795">-->
        <!--<img id="privmethod" alt="Private method"-->
             <!--src="http://i.msdn.microsoft.com/areas/global/content/clear.gif" title="Private method"-->
             <!--class="cl_IC6709">-->
        <!--<img id="xna" alt="Supported by the XNA Framework"-->
             <!--src="http://i.msdn.microsoft.com/areas/global/content/clear.gif"-->
             <!--title="Supported by the XNA Framework" class="cl_IC37116">-->
    <!--</td>-->
    <!--<td>-->
        <!--<a href="http://msdn.microsoft.com/en-us/library/bb337393">IConvertible<span>.</span>ToSByte</a>-->
    <!--</td>-->
    <!--<td>Infrastructure. <span>This conversion is not supported. Attempting to make this conversion throws an <span><a-->
            <!--href="http://msdn.microsoft.com/en-us/library/system.invalidcastexception">InvalidCastException</a></span>.</span>-->
    <!--</td>-->
<!--</tr>-->
<!--<tr data="explicit;declared;xnafw;">-->

    <!--<td>-->
        <!--<img id="pubinterface" alt="Explicit interface implemetation"-->
             <!--src="http://i.msdn.microsoft.com/areas/global/content/clear.gif"-->
             <!--title="Explicit interface implemetation" class="cl_IC141795">-->
        <!--<img id="privmethod" alt="Private method"-->
             <!--src="http://i.msdn.microsoft.com/areas/global/content/clear.gif" title="Private method"-->
             <!--class="cl_IC6709">-->
        <!--<img id="xna" alt="Supported by the XNA Framework"-->
             <!--src="http://i.msdn.microsoft.com/areas/global/content/clear.gif"-->
             <!--title="Supported by the XNA Framework" class="cl_IC37116">-->
    <!--</td>-->
    <!--<td>-->
        <!--<a href="http://msdn.microsoft.com/en-us/library/bb298221">IConvertible<span>.</span>ToSingle</a>-->
    <!--</td>-->
    <!--<td>Infrastructure. <span>This conversion is not supported. Attempting to make this conversion throws an <span><a-->
            <!--href="http://msdn.microsoft.com/en-us/library/system.invalidcastexception">InvalidCastException</a></span>.</span>-->
    <!--</td>-->
<!--</tr>-->
<!--<tr data="explicit;declared;xnafw;">-->

    <!--<td>-->
        <!--<img id="pubinterface" alt="Explicit interface implemetation"-->
             <!--src="http://i.msdn.microsoft.com/areas/global/content/clear.gif"-->
             <!--title="Explicit interface implemetation" class="cl_IC141795">-->
        <!--<img id="privmethod" alt="Private method"-->
             <!--src="http://i.msdn.microsoft.com/areas/global/content/clear.gif" title="Private method"-->
             <!--class="cl_IC6709">-->
        <!--<img id="xna" alt="Supported by the XNA Framework"-->
             <!--src="http://i.msdn.microsoft.com/areas/global/content/clear.gif"-->
             <!--title="Supported by the XNA Framework" class="cl_IC37116">-->
    <!--</td>-->
    <!--<td>-->
        <!--<a href="http://msdn.microsoft.com/en-us/library/bb337734">IConvertible<span>.</span>ToType</a>-->
    <!--</td>-->
    <!--<td>Infrastructure. <span>Converts the current <span><span class="selflink">DBNull</span></span> object to the specified type.</span>-->
    <!--</td>-->
<!--</tr>-->
<!--<tr data="explicit;declared;xnafw;">-->

    <!--<td>-->
        <!--<img id="pubinterface" alt="Explicit interface implemetation"-->
             <!--src="http://i.msdn.microsoft.com/areas/global/content/clear.gif"-->
             <!--title="Explicit interface implemetation" class="cl_IC141795">-->
        <!--<img id="privmethod" alt="Private method"-->
             <!--src="http://i.msdn.microsoft.com/areas/global/content/clear.gif" title="Private method"-->
             <!--class="cl_IC6709">-->
        <!--<img id="xna" alt="Supported by the XNA Framework"-->
             <!--src="http://i.msdn.microsoft.com/areas/global/content/clear.gif"-->
             <!--title="Supported by the XNA Framework" class="cl_IC37116">-->
    <!--</td>-->
    <!--<td>-->
        <!--<a href="http://msdn.microsoft.com/en-us/library/bb347557">IConvertible<span>.</span>ToUInt16</a>-->
    <!--</td>-->
    <!--<td>Infrastructure. <span>This conversion is not supported. Attempting to make this conversion throws an <span><a-->
            <!--href="http://msdn.microsoft.com/en-us/library/system.invalidcastexception">InvalidCastException</a></span>.</span>-->
    <!--</td>-->
<!--</tr>-->
<!--<tr data="explicit;declared;xnafw;">-->

    <!--<td>-->
        <!--<img id="pubinterface" alt="Explicit interface implemetation"-->
             <!--src="http://i.msdn.microsoft.com/areas/global/content/clear.gif"-->
             <!--title="Explicit interface implemetation" class="cl_IC141795">-->
        <!--<img id="privmethod" alt="Private method"-->
             <!--src="http://i.msdn.microsoft.com/areas/global/content/clear.gif" title="Private method"-->
             <!--class="cl_IC6709">-->
        <!--<img id="xna" alt="Supported by the XNA Framework"-->
             <!--src="http://i.msdn.microsoft.com/areas/global/content/clear.gif"-->
             <!--title="Supported by the XNA Framework" class="cl_IC37116">-->
    <!--</td>-->
    <!--<td>-->
        <!--<a href="http://msdn.microsoft.com/en-us/library/bb347553">IConvertible<span>.</span>ToUInt32</a>-->
    <!--</td>-->
    <!--<td>Infrastructure. <span>This conversion is not supported. Attempting to make this conversion throws an <span><a-->
            <!--href="http://msdn.microsoft.com/en-us/library/system.invalidcastexception">InvalidCastException</a></span>.</span>-->
    <!--</td>-->
<!--</tr>-->
<!--<tr data="explicit;declared;xnafw;">-->

    <!--<td>-->
        <!--<img id="pubinterface" alt="Explicit interface implemetation"-->
             <!--src="http://i.msdn.microsoft.com/areas/global/content/clear.gif"-->
             <!--title="Explicit interface implemetation" class="cl_IC141795">-->
        <!--<img id="privmethod" alt="Private method"-->
             <!--src="http://i.msdn.microsoft.com/areas/global/content/clear.gif" title="Private method"-->
             <!--class="cl_IC6709">-->
        <!--<img id="xna" alt="Supported by the XNA Framework"-->
             <!--src="http://i.msdn.microsoft.com/areas/global/content/clear.gif"-->
             <!--title="Supported by the XNA Framework" class="cl_IC37116">-->
    <!--</td>-->
    <!--<td>-->
        <!--<a href="http://msdn.microsoft.com/en-us/library/bb302206">IConvertible<span>.</span>ToUInt64</a>-->
    <!--</td>-->
    <!--<td>Infrastructure. <span>This conversion is not supported. Attempting to make this conversion throws an <span><a-->
            <!--href="http://msdn.microsoft.com/en-us/library/system.invalidcastexception">InvalidCastException</a></span>.</span>-->
    <!--</td>-->
<!--</tr>-->
<!--</tbody>-->
<!--</table>-->
<!--<a href="#mainBody">Top</a></div>-->
<!--</div>-->
<!--<div>-->
    <!--<div class="LW_CollapsibleArea_TitleDiv">-->
        <!--<div><a href="javascript:void(0)" class="LW_CollapsibleArea_TitleAhref" title="Collapse"><span-->
                <!--class="cl_CollapsibleArea_expanding LW_CollapsibleArea_Img"></span><span-->
                <!--class="LW_CollapsibleArea_Title">Remarks</span></a>-->

            <!--<div class="LW_CollapsibleArea_HrDiv">-->
                <!--<hr class="LW_CollapsibleArea_Hr">-->
            <!--</div>-->
        <!--</div>-->
    <!--</div>-->
    <!--<div class="sectionblock"><a id="remarksToggle">-->

    <!--</a>-->

        <!--<p>The <span><span class="selflink">DBNull</span></span> class represents a-->
            <!--nonexistent value. In a database, for example, a column in a row of a table might not contain any data-->
            <!--whatsoever. That is, the column is considered to not exist at all instead of merely not having a value. A-->
            <!--<span><span class="selflink">DBNull</span></span> object represents the nonexistent column. Additionally,-->
            <!--COM interop uses the <span><span class="selflink">DBNull</span></span> class to distinguish between a-->
            <!--VT_NULL variant, which indicates a nonexistent value, and a VT_EMPTY variant, which indicates an unspecified-->
            <!--value.</p>-->

        <!--<p>The <span><span class="selflink">DBNull</span></span> type is a-->
            <!--singleton class, which means only one <span><span class="selflink">DBNull</span></span> object exists. The-->
            <!--<span><a href="http://msdn.microsoft.com/en-us/library/system.dbnull.value">DBNull<span>.</span>Value</a></span>-->
            <!--member represents the sole <span><span class="selflink">DBNull</span></span> object. <span><a-->
                    <!--href="http://msdn.microsoft.com/en-us/library/system.dbnull.value">DBNull<span>.</span>Value</a></span>-->
            <!--can be used to explicitly assign a nonexistent value to a database field, although most ADO.NET data-->
            <!--providers automatically assign values of <span><span class="selflink">DBNull</span></span> when a field does-->
            <!--not have a valid value. You can determine whether a value retrieved from a database field is a <span><span-->
                    <!--class="selflink">DBNull</span></span> value by passing the value of that field to the <span><span-->
                    <!--class="input">DBNull.Value.Equals</span></span> method. However, some languages and database objects-->
            <!--supply methods that make it easier to determine whether the value of a database field is <span><a-->
                    <!--href="http://msdn.microsoft.com/en-us/library/system.dbnull.value">DBNull<span>.</span>Value</a></span>.-->
            <!--These include the Visual Basic <span><span class="input">IsDBNull</span></span> function, the <span><a-->
                    <!--href="http://msdn.microsoft.com/en-us/library/system.convert.isdbnull">Convert<span>.</span>IsDBNull</a></span> method, the <span>-->
                <!--<a href="http://msdn.microsoft.com/en-us/library/system.data.datatablereader.isdbnull">DataTableReader<span>.</span>IsDBNull</a></span> method, and the <span>-->
                <!--<a href="http://msdn.microsoft.com/en-us/library/system.data.idatarecord.isdbnull">IDataRecord<span>.</span>IsDBNull</a></span> method.</p>-->

        <!--<p>Do not confuse the notion of <span><span class="input"><span>null</span></span><span></span>-->
        <!--</span> in an object-oriented programming language with a <span><span class="selflink">DBNull</span></span>-->
            <!--object. In an object-oriented programming language, <span><span class="input"><span>null</span></span><span></span></span> means the absence of a reference to an-->
            <!--object. <span><span class="selflink">DBNull</span></span> represents an uninitialized variant or nonexistent-->
            <!--database column.</p>-->
    <!--</div>-->
<!--</div>-->
<div>
    <div class="LW_CollapsibleArea_TitleDiv">
        <div><a href="javascript:void(0)" class="LW_CollapsibleArea_TitleAhref" title="Collapse"><span
                class="cl_CollapsibleArea_expanding LW_CollapsibleArea_Img"></span><span
                class="LW_CollapsibleArea_Title">Examples</span></a>

            <div class="LW_CollapsibleArea_HrDiv">
                <hr class="LW_CollapsibleArea_Hr">
            </div>
        </div>
    </div>
    <div class="sectionblock"><a id="exampleToggle">

    </a>

        <p>The following example calls the <span><span class="input">DBNull.Value.Equals</span></span>
            method to determine whether a database field in a contacts database has a valid value. If it does, the field
            value is appended to the string output in a label.</p>

        <div>
            <div class="codeSnippetContainer">
                <!--<div class="codeSnippetContainerTabs">-->
                    <!--<div class="codeSnippetContainerTab codeSnippetContainerTabActive codeSnippetContainerTabFirst"-->
                         <!--dir="ltr"><a>C#</a></div>-->
                    <!--<div class="codeSnippetContainerTab codeSnippetContainerTabLast" dir="ltr"><a-->
                            <!--href="javascript: CodeSnippet_SetLanguage('CodeSnippetContainerLang', 'Programming', 'Visual Basic');">VB</a>-->
                    <!--</div>-->
                <!--</div>-->
                <div class="codeSnippetContainerCodeContainer">
                    <div class="codeSnippetToolBar">
                        <div class="codeSnippetToolBarText">
                            <a name="CodeSnippetCopyLink" title="Copy to clipboard."
                               href="javascript:CodeSnippet_CopyCode('CodeSnippetContainerCode_ed9cde19-f341-421e-bb08-1d2550750412');">Copy</a>
                        </div>
                    </div>
                    <div id="CodeSnippetContainerCode_ed9cde19-f341-421e-bb08-1d2550750412"
                         class="codeSnippetContainerCode" dir="ltr">
                        <div style="color:Black;"><pre><span style="color:Blue;">private</span>&nbsp;<span
                                style="color:Blue;">void</span> OutputLabels(DataTable dt)
{
   <span style="color:Blue;">string</span> label; 

   <span style="color:Green;">// Iterate rows of table&nbsp;</span>
   <span style="color:Blue;">foreach</span> (DataRow row <span style="color:Blue;">in</span> dt.Rows)
   {
      <span style="color:Blue;">int</span> labelLen;
      label = String.Empty;
      label += AddFieldValue(label, row, <span style="color:#A31515;">"Title"</span>);
      label += AddFieldValue(label, row, <span style="color:#A31515;">"FirstName"</span>);
      label += AddFieldValue(label, row, <span style="color:#A31515;">"MiddleInitial"</span>);
      label += AddFieldValue(label, row, <span style="color:#A31515;">"LastName"</span>);
      label += AddFieldValue(label, row, <span style="color:#A31515;">"Suffix"</span>);
      label += <span style="color:#A31515;">"\n"</span>;
      label += AddFieldValue(label, row, <span style="color:#A31515;">"Address1"</span>);
      label += AddFieldValue(label, row, <span style="color:#A31515;">"AptNo"</span>);
      label += <span style="color:#A31515;">"\n"</span>;
      labelLen = label.Length;
      label += AddFieldValue(label, row, <span style="color:#A31515;">"Address2"</span>);
      <span style="color:Blue;">if</span> (label.Length != labelLen)
         label += <span style="color:#A31515;">"\n"</span>;
      label += AddFieldValue(label, row, <span style="color:#A31515;">"City"</span>);
      label += AddFieldValue(label, row, <span style="color:#A31515;">"State"</span>);
      label += AddFieldValue(label, row, <span style="color:#A31515;">"Zip"</span>);
      Console.WriteLine(label);
      Console.WriteLine();
   }
}

<span style="color:Blue;">private</span>&nbsp;<span style="color:Blue;">string</span> AddFieldValue(<span
                                    style="color:Blue;">string</span> label, DataRow row, 
                             <span style="color:Blue;">string</span> fieldName) 
{                                
   <span style="color:Blue;">if</span> (! DBNull.Value.Equals(row[fieldName])) 
      <span style="color:Blue;">return</span> (<span style="color:Blue;">string</span>) row[fieldName] + <span
                                    style="color:#A31515;">" "</span>;
   <span style="color:Blue;">else</span>&nbsp;
      <span style="color:Blue;">return</span> String.Empty;
}
</pre>
                        </div>

                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!--<div>-->
    <!--<div class="LW_CollapsibleArea_TitleDiv">-->
        <!--<div><a href="javascript:void(0)" class="LW_CollapsibleArea_TitleAhref" title="Collapse"><span-->
                <!--class="cl_CollapsibleArea_expanding LW_CollapsibleArea_Img"></span><span-->
                <!--class="LW_CollapsibleArea_Title">Version Information</span></a>-->

            <!--<div class="LW_CollapsibleArea_HrDiv">-->
                <!--<hr class="LW_CollapsibleArea_Hr">-->
            <!--</div>-->
        <!--</div>-->
    <!--</div>-->
    <!--<div class="sectionblock"><a id="versionsTitleToggle">-->

    <!--</a>-->
        <!--<h4 class="subHeading">.NET Framework</h4>Supported in: 4.5, 4, 3.5, 3.0,-->
        <!--2.0, 1.1, 1.0<br><h4 class="subHeading">.NET Framework-->
            <!--Client Profile</h4>Supported in: 4, 3.5 SP1<br></div>-->
<!--</div>-->
<!--<div>-->
    <!--<div class="LW_CollapsibleArea_TitleDiv">-->
        <!--<div><a href="javascript:void(0)" class="LW_CollapsibleArea_TitleAhref" title="Collapse"><span-->
                <!--class="cl_CollapsibleArea_expanding LW_CollapsibleArea_Img"></span><span-->
                <!--class="LW_CollapsibleArea_Title">Platforms</span></a>-->

            <!--<div class="LW_CollapsibleArea_HrDiv">-->
                <!--<hr class="LW_CollapsibleArea_Hr">-->
            <!--</div>-->
        <!--</div>-->
    <!--</div>-->
    <!--<div class="sectionblock"><a id="platformsTitleToggle">-->

    <!--</a>-->

        <!--<p>Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows-->
            <!--Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or-->
            <!--later; Itanium not supported)</p>-->

        <!--<p>  <span>-->
		  <!--The .NET Framework does not support all versions of every platform. For a list of the supported versions, see <a-->
                <!--href="http://msdn.microsoft.com/en-us/library/8z6watww">.NET Framework System Requirements</a>.-->
	  <!--</span></p></div>-->
<!--</div>-->
<!--<div>-->
    <!--<div class="LW_CollapsibleArea_TitleDiv">-->
        <!--<div><a href="javascript:void(0)" class="LW_CollapsibleArea_TitleAhref" title="Collapse"><span-->
                <!--class="cl_CollapsibleArea_expanding LW_CollapsibleArea_Img"></span><span-->
                <!--class="LW_CollapsibleArea_Title">Thread Safety</span></a>-->

            <!--<div class="LW_CollapsibleArea_HrDiv">-->
                <!--<hr class="LW_CollapsibleArea_Hr">-->
            <!--</div>-->
        <!--</div>-->
    <!--</div>-->
    <!--<div class="sectionblock"><a id="threadSafetyToggle">-->

    <!--</a>Any public <span class="input">static</span> (<span class="input">Shared</span>-->
        <!--in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread-->
        <!--safe.-->
    <!--</div>-->
<!--</div>-->
<!--<div>-->
    <!--<div class="LW_CollapsibleArea_TitleDiv">-->
        <!--<div><a href="javascript:void(0)" class="LW_CollapsibleArea_TitleAhref" title="Collapse"><span-->
                <!--class="cl_CollapsibleArea_expanding LW_CollapsibleArea_Img"></span><span-->
                <!--class="LW_CollapsibleArea_Title">See Also</span></a>-->

            <!--<div class="LW_CollapsibleArea_HrDiv">-->
                <!--<hr class="LW_CollapsibleArea_Hr">-->
            <!--</div>-->
        <!--</div>-->
    <!--</div>-->
    <!--<div class="sectionblock"><a id="seeAlsoToggle">-->

    <!--</a>-->
        <!--<h4 class="subHeading">Reference</h4>-->

        <!--<div class="seeAlsoStyle">-->
            <!--<a href="http://msdn.microsoft.com/en-us/library/system">System Namespace</a>-->
        <!--</div>-->
        <!--<div class="seeAlsoStyle">-->
  <!--<span>-->
    <!--<a href="http://msdn.microsoft.com/en-us/library/system.convert.dbnull">Convert<span>.</span>DBNull</a>-->
  <!--</span>-->
        <!--</div>-->
        <!--<div class="seeAlsoStyle">-->
  <!--<span>-->
    <!--<a href="http://msdn.microsoft.com/en-us/library/system.convert.isdbnull">Convert<span>.</span>IsDBNull</a>-->
  <!--</span>-->
        <!--</div>-->
        <!--<div class="seeAlsoStyle">-->
  <!--<span>-->
    <!--<a href="http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.varenum">System.Runtime.InteropServices<span-->
            <!--xmlns="">.</span>VarEnum</a>-->
  <!--</span>-->
        <!--</div>-->
    <!--</div>-->
<!--</div>-->
</div>
</div>
</div>
</div>


<div id="contentFeedback1">
    <!--<form method="post" action="/en-us/library/feedback/add/system.dbnull">-->
        <!--<input name="__RequestVerificationToken" type="hidden"-->
               <!--value="GhhNEtTI3kuki4np4g34KkGol1bJTyD7ZjVaq7kj9vpMy7LlRyo0s6zAzzM6YsPX2VtlCfWery5lXDy/rawtiB7XONUnu0ggUbPMKPqf9/8cj54pPTAknJWoK8G4HnxRPEFQtw==">-->

        <!--<div id="contentFeedbackContainer">-->
            <!--<div class="FeedbackTitleContainer">-->
                <!--<a name="feedback"></a>-->
                <!--Did you find this helpful?-->
                <!--<input id="rdIsUsefulYes" name="rdIsUseful" type="radio" value="1"-->
                       <!--onclick="toggleContentFeedback('Yes');"><label for="rdIsUsefulYes">Yes</label>-->
                <!--<input id="rdIsUsefulNo" name="rdIsUseful" type="radio" value="0"-->
                       <!--onclick="toggleContentFeedback('No');"><label for="rdIsUsefulNo">No</label>-->

            <!--</div>-->

            <!--<div id="contentFeedbackQAContainer">-->

                <!--<div id="feedbackListNoContainer" class="FeedbackListContainer">-->

                    <!--<div>-->
                        <!--<input id="chkbxNo201" name="chkbxNo" type="checkbox" value="201">-->
                        <!--<label for="chkbxNo201">Not accurate</label>-->
                    <!--</div>-->

                    <!--<div>-->
                        <!--<input id="chkbxNo202" name="chkbxNo" type="checkbox" value="202">-->
                        <!--<label for="chkbxNo202">Not enough depth</label>-->
                    <!--</div>-->

                    <!--<div>-->
                        <!--<input id="chkbxNo203" name="chkbxNo" type="checkbox" value="203">-->
                        <!--<label for="chkbxNo203">Need more code examples</label>-->
                    <!--</div>-->

                <!--</div>-->

                <!--<div class="FeedbackTellUsMoreContainer">-->
                    <!--<textarea id="feedbackText" name="feedbackText" class="TellUsMoreTextBoxSearchLoaded"-->
                              <!--onfocus="WatermarkFocus(this, 'Tell us more...', 'TellUsMoreTextBoxSearch')"-->
                              <!--onblur="WatermarkBlur(this, 'Tell us more...', 'TellUsMoreTextBoxSearchLoaded')"-->
                              <!--onmouseover="TextBoxCharactersCounter(this, document.getElementById('feedbackTextCounter'), 1500)"-->
                              <!--onkeydown="TextBoxCharactersCounter(this, document.getElementById('feedbackTextCounter'), 1500)"-->
                              <!--onkeyup="TextBoxCharactersCounter(this, document.getElementById('feedbackTextCounter'), 1500)">Tell-->
                        <!--us more...</textarea>-->
                <!--</div>-->
                <!--<span class="counter">(<span id="feedbackTextCounter">1500</span> characters remaining)</span>-->
                <!--<input type="hidden" id="returnUrl" name="returnUrl"-->
                       <!--value="http://msdn.microsoft.com/en-us/library/system.dbnull">-->
                <!--<input type="submit" id="submit" value="Submit" title="Click to Submit Feedback"-->
                       <!--onclick="WatermarkOnSubmit(document.getElementById('feedbackText'), 'Tell us more...', 'TellUsMoreTextBoxSearch')">-->

                <!--<div style="clear: both;"></div>-->
            <!--</div>-->

        <!--</div>-->
    <!--</form>-->
</div>

<!--</div>-->

</body>
</html>